﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebTemplate.DAL.Entities;
using WebTemplate.DAL.Repositories;

namespace WebTemplate.Web.Membership
{
    public partial class Signup : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Reg_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(this.Pass.Text, "SHA1");
                //-------------------------------------------------------------------------------------------------------

                MemberReprositry store = new MemberReprositry();
                Members member = new Members();
                member.FirstName = this.FirstName.Text;
                member.LastName = this.LastName.Text;
                member.Email = this.mail.Text;
                member.Password = hashedPassword;
                member.UserID = this.FacultyID.Text;

                member.IsActive = false;
                store.Insert(member);

                Response.Redirect("~/Default.aspx");


            }
        }
    }
}